Skip to content

ci: add Cata dispatch workflow#124

Merged
jpleva91 merged 1 commit intomainfrom
feat/cata-dispatch-workflow
Apr 4, 2026
Merged

ci: add Cata dispatch workflow#124
jpleva91 merged 1 commit intomainfrom
feat/cata-dispatch-workflow

Conversation

@jpleva91
Copy link
Copy Markdown
Contributor

@jpleva91 jpleva91 commented Apr 4, 2026

Summary

  • Adds cata-dispatch.yml GitHub Actions workflow to enable repository_dispatch events
  • Allows the Octi Pulpo brain to dispatch tasks to Cata agents running in this repo via GitHub Actions
  • Part of the governed SDLC pipeline where Octi Pulpo coordinates work across repos

Test plan

  • Verify workflow file passes GitHub Actions syntax validation
  • Test a repository_dispatch event from Octi Pulpo brain targeting this repo
  • Confirm Cata agent picks up and executes the dispatched task

🤖 Generated with Claude Code

Enables repository_dispatch events so the Octi Pulpo brain can dispatch
tasks to Cata agents via GitHub Actions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 4, 2026 16:12

jobs:
cata-agent:
runs-on: ubuntu-latest

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 6 days ago

In general, this problem is fixed by adding an explicit permissions block either at the top level of the workflow (applies to all jobs) or under the specific job, granting only the scopes and access levels required. For workflows that only need to read repository contents and releases, contents: read is typically sufficient.

For this specific workflow, the only visible operations that rely on GitHub API access are: actions/checkout@v4, which needs read access to repository contents, and gh release download using GITHUB_TOKEN, which also requires read access to releases (covered by contents: read). There is no evidence this job needs to write to the repository or to issues/PRs. Therefore, the best minimal change is to add permissions: contents: read at the workflow root, just under the name: (or under on:) so that it applies to the cata-agent job without altering its behavior.

Concretely, edit .github/workflows/cata-dispatch.yml and insert:

permissions:
  contents: read

near the top-level keys. No additional imports or tooling changes are required.

Suggested changeset 1
.github/workflows/cata-dispatch.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/cata-dispatch.yml b/.github/workflows/cata-dispatch.yml
--- a/.github/workflows/cata-dispatch.yml
+++ b/.github/workflows/cata-dispatch.yml
@@ -2,6 +2,8 @@
 on:
   repository_dispatch:
     types: [octi-pulpo-dispatch]
+permissions:
+  contents: read
 
 jobs:
   cata-agent:
EOF
@@ -2,6 +2,8 @@
on:
repository_dispatch:
types: [octi-pulpo-dispatch]
permissions:
contents: read

jobs:
cata-agent:
Copilot is powered by AI and may make mistakes. Always verify output.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new GitHub Actions workflow that listens for repository_dispatch events and runs a Cata agent job in response, enabling Octi Pulpo to remotely dispatch work into this repo via Actions.

Changes:

  • Introduces .github/workflows/cata-dispatch.yml to trigger on repository_dispatch type octi-pulpo-dispatch.
  • Downloads a cata Linux binary from AgentGuardHQ/cata releases and executes it with task metadata from client_payload.
  • Emits a simple completion/status message at the end of the run.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


jobs:
cata-agent:
runs-on: ubuntu-latest
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider explicitly setting permissions for this workflow/job (least privilege). Without it, the GITHUB_TOKEN permissions depend on repo defaults and may be broader than needed for a dispatch-triggered, prompt-driven job. For example, .github/workflows/release.yml explicitly sets permissions: contents: write; this workflow should similarly declare only what Cata needs (often contents: read plus narrowly scoped write permissions if it must open PRs/push).

Suggested change
runs-on: ubuntu-latest
runs-on: ubuntu-latest
permissions:
contents: read

Copilot uses AI. Check for mistakes.
Comment on lines +2 to +4
on:
repository_dispatch:
types: [octi-pulpo-dispatch]
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

repository_dispatch will run this workflow for any actor/token that can send that event to the repo. Since the payload includes an arbitrary prompt that drives automation, add a verification gate (e.g., require a shared secret/HMAC in client_payload that matches a repo secret, and/or restrict github.event.sender.login/actor allowlist) to prevent unauthorized dispatches from executing tasks with repo credentials.

Copilot uses AI. Check for mistakes.
Comment on lines +29 to +33
gh release download --repo AgentGuardHQ/cata \
--pattern "cata-linux-amd64" \
--output cata \
--clobber || echo "WARN: cata release not yet published"
chmod +x cata 2>/dev/null || true
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow downloads and executes a prebuilt binary from another repo release without integrity verification. To reduce supply-chain risk, pin to a specific release version and verify a published checksum/signature before chmod/execution (or build from source within the workflow).

Copilot uses AI. Check for mistakes.
Comment on lines +53 to +54
"${TASK_PROMPT}" \
|| echo "WARN: cata exited non-zero for task ${TASK_ID}"
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

./cata run ... || echo ... masks non-zero exit codes (including missing execute permission, runtime errors, or failed tasks), so the job can report success even when the agent fails. If downstream systems rely on workflow status, let this step fail (or capture the exit code and explicitly exit $code after logging) so job.status reflects the real outcome.

Suggested change
"${TASK_PROMPT}" \
|| echo "WARN: cata exited non-zero for task ${TASK_ID}"
"${TASK_PROMPT}"
cata_exit_code=$?
if [ "$cata_exit_code" -ne 0 ]; then
echo "WARN: cata exited non-zero for task ${TASK_ID}"
exit "$cata_exit_code"
fi

Copilot uses AI. Check for mistakes.

jobs:
cata-agent:
runs-on: ubuntu-latest
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This job can run for a long time (--max-turns 100) and can be dispatched repeatedly; consider adding timeout-minutes and a concurrency group (e.g., per TASK_ID or a single global group) to prevent runaway runs and reduce the chance of overlapping agents contending for the repo workspace/credentials.

Suggested change
runs-on: ubuntu-latest
runs-on: ubuntu-latest
timeout-minutes: 60
concurrency:
group: cata-agent-${{ github.event.client_payload.task_id }}
cancel-in-progress: true

Copilot uses AI. Check for mistakes.
@jpleva91 jpleva91 merged commit e058b04 into main Apr 4, 2026
10 checks passed
@jpleva91 jpleva91 deleted the feat/cata-dispatch-workflow branch April 4, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants